import java.util.Scanner;
public class Main
{
 public static void main(String[] args) 
 {
	 Scanner in = new Scanner(System.in);
	 int l = in.nextInt(), r = in.nextInt();
	 int ret = 0;
	 for(int i = l; i <= r; i++)
	 {
		 int tmp = i;
		 while(tmp != 0)
		 {
			 if(tmp % 10 == 2) ret++;
			 tmp /= 10;
		 }
	 }
	 System.out.println(ret);
 }
}